package com.yunhai.device.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yunhai.common.dto.PaginationVo;
import com.yunhai.common.dto.Ret;
import com.yunhai.device.service.OrrBusinessDurationEfficiencyService;
import com.yunhai.model.entity.orr.OrrBusinessDurationEfficiencyEntity;
import com.yunhai.model.vo.orr.OrrBusinessDurationEfficiencyQuery;
import com.yunhai.model.vo.orr.OrrBusinessDurationEfficiencyVo;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/orrBusinessDurationEfficiency")
public class OrrBusinessDurationEfficiencyController {

	@Resource
	private OrrBusinessDurationEfficiencyService orrBusinessDurationEfficiencyService;


	/**
	 * 获取 OrrBusinessDurationEfficiency 分页列表
	 */
	@GetMapping("/pagination")
	public Ret getOrrBusinessDurationEfficiencyPagination(PaginationVo paginationVo, OrrBusinessDurationEfficiencyQuery orrBusinessDurationEfficiencyQuery ) throws Exception {
		IPage page = orrBusinessDurationEfficiencyService.getOrrBusinessDurationEfficiencyPagination(paginationVo, orrBusinessDurationEfficiencyQuery );
		return Ret.toPage(page);
	}


	/**
	 * 获取 OrrBusinessDurationEfficiency 所有数据
	 */
	@GetMapping("/allList")
	public Ret getOrrBusinessDurationEfficiencyAllList( OrrBusinessDurationEfficiencyQuery orrBusinessDurationEfficiencyQuery ) throws Exception {
		List<OrrBusinessDurationEfficiencyEntity> list = orrBusinessDurationEfficiencyService.getOrrBusinessDurationEfficiencyAllList( orrBusinessDurationEfficiencyQuery );
		return Ret.ok(list);
	}


	/**
	 * 获取 OrrBusinessDurationEfficiency 详情
	 */
	@GetMapping("/{id}")
	public Ret getOrrBusinessDurationEfficiencyDetailById(@PathVariable Long id) throws Exception {

	    OrrBusinessDurationEfficiencyEntity orrBusinessDurationEfficiencyEntity = orrBusinessDurationEfficiencyService.getOrrBusinessDurationEfficiencyDetail(id);
		return Ret.ok(orrBusinessDurationEfficiencyEntity);
	}


	/**
	 * 新增 OrrBusinessDurationEfficiency
	 * */
	@PostMapping("")
	public Ret addOrrBusinessDurationEfficiency(@RequestBody OrrBusinessDurationEfficiencyVo orrBusinessDurationEfficiencyVo) throws Exception {

		orrBusinessDurationEfficiencyService.addOrrBusinessDurationEfficiency(orrBusinessDurationEfficiencyVo);
		return Ret.ok();
	}


	/**
	 * 更新 OrrBusinessDurationEfficiency
	 * */
	@PutMapping("")
	public Ret updateOrrBusinessDurationEfficiency(@RequestBody OrrBusinessDurationEfficiencyVo orrBusinessDurationEfficiencyVo) throws Exception {

		orrBusinessDurationEfficiencyService.updateOrrBusinessDurationEfficiency(orrBusinessDurationEfficiencyVo);
		return Ret.ok();
	}


	/**
	 * 删除 OrrBusinessDurationEfficiency
	 * */
	@PostMapping("/batchRemove")
	public Ret batchRemoveOrrBusinessDurationEfficiency( @RequestBody List<Long> ids ) throws Exception {

	    orrBusinessDurationEfficiencyService.batchRemoveOrrBusinessDurationEfficiency(ids);
		return Ret.ok();
	}
}
